/*
 * Copyright (C) 2015 yixun All Rights Reserved.
 * 
 * MechanismAccountTypeEnum.java
 */
package com.yixun.qfbao.model.enums;

import com.yixun.common.utils.EnumUtil;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
/**
 * [文件名称]<br>
 * LoanOrder.java<br>
 * <br>
 * [文件描述]<br>
 * 贷款订单表 pojo bean<br>
 * <br>
 * [修改记录]<br>
 * 2015-10-13 15:32:11 创建 陶俊代码生成器<br>
 * 
 * @author 陶俊代码生成器
 * @version 1.00
*/
public enum MechanismAccountTypeEnum implements Serializable{
		mechanism("0","管理员",null),
		individual("1","员工",null);
		
		private final String no;
		private final String des;
		private final Enum parent;
		
		static{
			EnumUtil.ENUMS_TO_VIEW.put("mechanism_account_type", MechanismAccountTypeEnum.values());
		}
		
		/**
		 * 私有构造函数
		 * @param no
		 * @param des
		 */
		MechanismAccountTypeEnum(String no, String des,Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static MechanismAccountTypeEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (MechanismAccountTypeEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static MechanismAccountTypeEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (MechanismAccountTypeEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
